package com.smartwebx.ha.web.admin.module.screen.group;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.dataresolver.Param;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.smartwebx.ha.biz.assign.HaGroupManager;
import com.smartwebx.ha.dal.assign.bean.HaGroup;

public class AjaxGetGroup {
	@Autowired
	private HttpServletResponse response;
	@Autowired
	private HaGroupManager haGroupManager;

	public void execute(@Param("id") Integer groupId) throws IOException {
		response.setContentType("application/json");
		PrintWriter out = response.getWriter();
		ObjectMapper mapper = new ObjectMapper();
		HaGroup group = haGroupManager.findOne(groupId);
		mapper.writeValue(out, group);
	}

}
